<?php


function isMobile() {
    $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $mobileAgents = array("android", "blackberry", "iphone", "ipad", "ipod", "iemobile", "opera mini", "webos", "googlebot-mobile");
    $isMobile = false;

    foreach ($mobileAgents as $agent) {
        if (strpos($userAgent, strtolower($agent)) !== false) {
            $isMobile = true;
            break;
        }
    }

    return $isMobile;
}